package codeTop;

public class q162 {
    public int findPeakElement(int[] nums) {
        int l = 0,r = nums.length-1;
        while (l < r) {
            int mid = l+(r-l)/2;
            int num;
            if (mid == nums.length - 1) {
                num = Integer.MIN_VALUE;
            }else {
                num = nums[mid+1];
            }
            if (nums[mid] < num) {
                l = mid+1;
            }else {
                r = mid;
            }
        }
        return l;
    }
}
